.TH BXB 1 "24 November 2002" "WFDB 10.3.0" "WFDB Applications Guide"
.SH NAME
bxb \- ANSI/AAMI-standard beat-by-beat annotation comparator
.SH SYNOPSIS
\fBbxb -r\fR \fIrecord\fR \fB-a\fR \fIreference-annotator test-annotator\fR [ \fIoptions ... \fR ]
.SH DESCRIPTION
.PP
Using options \fB-C\fR, \fB-L\fR, or \fB-S\fR, \fBbxb\fR implements the
beat-by-beat comparison algorithms described in ANSI/AAMI EC38:1998, the
\fIAmerican National Standard for Ambulatory ECGs\fR, and in ANSI/AAMI
EC57:1998, the \fIAmerican National Standard for Testing and Reporting
Performance Results of Cardiac Rhythm and ST Segment Measurement Algorithms\fR.
\fBbxb\fR is the reference implementation of these algorithms, and must be used
to obtain the beat-by-beat performance statistics cited in EC38 and EC57 in
order to be in compliance with these standards (see EC38, section 5.2.14, and
EC57, section 4.2).  The \fB-C\fR, \fB-L\fR, and \fB-S\fR options also gather
statistics on RR interval errors, which were considered for inclusion in EC38,
but were eventually dropped from it.
.PP
Input to this program consists of two annotation files associated with the same
\fIrecord\fR.  One of these is designated the \fIreference\fR annotation file,
the other the \fItest\fR annotation file (called the `algorithm' annotation
file in EC38 and in EC57).
.PP
\fIOptions\fR include:
.TP
\fB-c\fR \fIfile\fR
Append condensed reports (EC57 Table A.2.1 format) to \fIfile\fR.
.TP
\fB-C\fR \fIfile\fR
As for \fB-c\fR, but report RMS RR interval error and SVEB statistics also.
.TP
\fB-f\fR \fItime\fR
Begin the comparison at the specified \fItime\fR (default: 5 minutes after the
beginning of the record).
.TP
\fB-h\fR
Print a usage summary.
.TP
\fB-l\fR \fIfile1 file2\fR
Append line-format reports (EC57 Tables A.2 and A.3 format) to \fIfile1\fR and
\fIfile2\fR respectively (see below).
.TP
\fB-L\fR \fIfile1 file2\fR
As for \fB-l\fR, but report RMS RR interval error and SVEB statistics also.
.TP
\fB-o\fR
Generate an output annotation file (see below).
.TP
\fB-O\fR
Generate an expanded output annotation file (see below).
.TP
\fB-s\fR \fIfile\fR
Append standard reports (EC38, section 5.2.14, and EC57, Table 3 format) to
\fIfile\fR.
.TP
\fB-S\fR \fIfile\fR
As for \fB-s\fR, but report RMS RR interval error and SVEB statistics also.
.TP
\fB-t\fR \fItime\fR
Stop the comparison at the specified \fItime\fR (default: the end of the record
if it is defined, the end of the reference annotation file otherwise;  if
\fItime\fR is 0, the comparison ends when the end of either annotation file is
reached).
.TP
\fB-v\fR
Verbose mode (list all beat label discrepancies;  see below).
.TP
\fB-w\fR \fItime\fR
Set the \fImatch window\fR (default: 0.15 seconds;  see below).
.PP
The statistics gathered by \fBbxb\fR are based on tallies of `matching'
annotations in the reference and test annotation files.  Matching annotations
need not have exactly equal annotation times; the \fImatch window\fR specifies
the maximum absolute difference in annotation times that is permitted for
matching annotations.  \fBbxb\fR measures the total shutdown time in the test
annotation file as the sum of all intervals that begin with a `shutdown'
annotation and that end with a `resume' annotation.  (If a period of shutdown
does not end before the end of the record, the creator of the annotation file
should nevertheless write a `resume' annotation at the end of the record, in
order to permit correct shutdown accounting.)  This program follows the
convention for `shutdown' and `resume' annotations adopted for
reference annotation files of the European ST-T database, a convention
compatible with that established for the MIT-BIH Arrhythmia Database:
`shutdown' annotations are \fBNOISE\fR annotations with bits 4 and 5 (i.e.,
the `16' bit and the `32' bit) of the subtype field both set; `resume'
annotations are \fBNOISE\fR annotations with any other subtype.  The convention
used in AHA Database reference files, in which unreadable intervals are marked
by only one `shutdown' annotation placed near the middle of the interval, is
also acceptable; in this case, shutdown is assumed to begin 150 ms after the
previous annotation, and it is assumed to end 150 ms before the following
annotation.
.PP
At most one of \fB-c\fR, \fB-C\fR, \fB-l\fR, \fB-L\fR, \fB-O\fR, \fB-s\fR, and
\fB-S\fR can be given as an option.  If `\fB-\fR' is given as a \fIfile\fR
argument, reports are written on the standard output.  If no options are
specified, \fBbxb\fR writes standard reports on the standard output (equivalent
to using the option \fB-s -\fR).  The output generated by selecting \fB-l\fR or
\fB-L\fR includes column headings only if a \fIfile\fR other than `\fB-\fR' is
specified, and only if the specified \fIfile\fR does not already exist.  In
this way, \fBbxb\fR can be used repeatedly to build up a line-format table for
multiple records, for further processing by \fBsumstats\fR(1).
.PP
The \fB-o\fR option produces an output annotation file with annotator name
\fBbxb\fR.  The output annotation file contains exact copies of all of the
test annotator's beat labels that match those of the reference annotator,
as well as \fBNOTE\fR annotations that describe all mismatches. Mismatched
annotation types are mapped into the AAMI `test label' mnemonics (\fBN\fR,
\fBV\fR, \fBF\fR, \fBQ\fR, \fBO\fR, and \fBX\fR;  if the \fB-C\fR, \fB-L\fR,
or \fB-S\fR option is also specified, the mnemonics also include \fBS\fR).
The `aux' field of each \fBNOTE\fR annotation indicates the element of the
confusion matrix in which the mismatch is tallied (e.g., \fBNv\fR represents
an eventcalled a normal beat by the reference annotator and a ventricular
ectopic beat by the test annotator).  \fBNOTE\fR annotations that correspond
to beats missed by the test annotator are placed at the sample indicated by
the reference annotation;  all others are placed at that indicated by the test
annotation.
.PP
The \fB-O\fR option produces a similar output annotation file, in this case
containing not only beat labels but all others as well.  No summary report is
produced if \fB-O\fR is specified.  \fBNOTE\fR annotations produced using
\fB-O\fR contain unmapped annotation mnemonics from the input annotation files.
This option, if used together with \fB-f 0 -w 0\fR, identifies all
discrepancies between a pair of annotation files.  It can be especially useful
for developing reference annotation files for new records.
.PP
The \fB-v\fR option specifies that each beat label mismatch is described on the
standard output in a format similar to:
.br
	N(120188)/V(120191)
.br
where the letters indicate the AAMI mnemonics corresponding to the reference
and test annotators' beat labels, and the numbers indicate the \fItime\fR
fields (sample numbers) of the reference and test annotations respectively.
Note that \fBO\fR and \fBX\fR mnemonics are generated by \fBbxb\fR as
placeholders for missing beat labels;  you will not find them in the input
annotation files.
.SH ENVIRONMENT
.PP
It may be necessary to set and export the shell variable \fBWFDB\fR (see
\fBsetwfdb\fR(1)).
.SH DIAGNOSTICS
.TP
\fInon-standard comparison selected\fR
The \fB-f\fR, \fB-O\fR, \fB-t\fR, and \fB-w\fR options modify the comparison
algorithm used by \fBbxb\fR in ways not permitted by EC38 or EC57.
These options are provided for the use of developers, who may find them useful
for obtaining a more detailed understanding of algorithm errors.
.SH SEE ALSO
\fBecgeval\fR(1), \fBepicmp\fR(1), \fBmxm\fR(1), \fBrxr\fR(1),
\fBsetwfdb\fR(1), \fBsumstats\fR(1)
.br
\fIEvaluating ECG Analyzers\fR (in the \fIWFDB Applications Guide\fR)
.br
\fIAmerican National Standard ANSI/AAMI EC38:1998, Ambulatory
Electrocardiographs\fR
.br
\fIAmerican National Standard ANSI/AAMI EC57:1998, Testing and Reporting
Performance Results of Cardiac Rhythm and ST Segment Measurement Algorithms\fR
.br
The last two publications are available from AAMI, 1110 N Glebe Road,
Suite 220, Arlington, VA 22201 USA (http://www.aami.org/).
.SH AUTHOR
George B. Moody (george@mit.edu)
.SH SOURCE
http://www.physionet.org/physiotools/wfdb/app/bxb.c
